package com.oocl.im.handle.impl;

import java.util.List;

import com.oocl.im.ui.ChatFrame;
import com.oocl.im.constants.ClientMaintenance;
import com.oocl.im.constants.Constants;
import com.oocl.im.entity.Client;
import com.oocl.im.entity.Protocol;
import com.oocl.im.handle.IHandle;

public class ResponseHandle implements IHandle{
	@Override
	public void handle(Protocol protocol) {
		String status = (String) protocol.getParams().get(Constants.STATUS);
		System.out.println("in response handler: "+protocol);
		if(Constants.SUCCESS.equals(status)){
			@SuppressWarnings("unchecked")
			List<String> list = (List<String>) protocol.getParams().get(Constants.LIST);
			
			ClientMaintenance.clientList =  list;
			ClientMaintenance.client = (Client) protocol.getParams().get(Constants.TO);
			ClientMaintenance.currentChatUser = ClientMaintenance.client;
			new ChatFrame();
		}
		else {
			
		}
		
	}
	
}
